package neu.soft.config;

import com.alibaba.fastjson.JSONObject;
import neu.soft.vo.MsgBean;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

public class ServerEncoder implements Encoder.Text<MsgBean>{

    @Override
    public String encode(MsgBean object) throws EncodeException {

        try {
            return JSONObject.toJSONString(object);
        }catch (Exception e){
           e.getStackTrace();
        }
        return null;

    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
